package com.github.ilioili.justdoit.model.pojo;

import com.github.ilioili.justdoit.common.config.EventConstants;
import com.github.ilioili.justdoit.util.sql.SqlField;

/**
 * Created by hantuo on 16/5/11.
 */
public class EventRecord {
    @SqlField(type = SqlField.SqlType.PRIMARY_KEY)
    public String id;
    public long eventId;
    public int year;
    public int month;
    public int day;
    /**
     * 忘记 就想偷懒 为时已晚 半途而废 亡羊补牢 基本搞定 全部搞定
     */
    public int state = EventConstants.STATE_FORGET;




    public EventRecord() {

    }

    public EventRecord(int year, int month, int day, long eventId) {
        this.year = year;
        this.month = month;
        this.day = day;
        this.id = "" + eventId + year + month + day;
        this.eventId = eventId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        EventRecord that = (EventRecord) o;

        if (eventId != that.eventId) return false;
        if (year != that.year) return false;
        if (month != that.month) return false;
        if (day != that.day) return false;
        if (state != that.state) return false;
        return id != null ? id.equals(that.id) : that.id == null;

    }

    @Override
    public int hashCode() {
        int result = (int) (eventId ^ (eventId >>> 32));
        result = 31 * result + year;
        result = 31 * result + month;
        result = 31 * result + day;
        result = 31 * result + (id != null ? id.hashCode() : 0);
        result = 31 * result + state;
        return result;
    }
}
